Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

336
Views
"bash" no se encuentra al ejecutar xargs en kubernetes

Estoy tratando de usar/comprender xargs para imprimir varios detalles para algunos pods que tengo en ejecución en kubernetes en diferentes espacios de nombres. Por ejemplo, este comando da:

 $ kubectl get pods -A | grep Error | awk '{print $2 " -n=" $1}' my-pod-kf8xch6y-qc6ms-k6ww2 -n=my-ns my-pod-kf8xlg64-g0ss7-mdv1x -n=my-ns my-pod-kldslg64-polf7-msdw3 -n=another-ns

que es correcto/esperado.

Cuando agrego xargs al comando anterior, obtengo:

 $ kubectl get pods -A | grep Error | awk '{print $2 " -n=" $1}' | xargs kubectl $1 get pod $0 -oyaml | grep phase Error from server (NotFound): pods "bash" not found phase: Failed phase: Failed

Que es en realidad el resultado esperado pero no entiendo

 Error from server (NotFound): pods "bash" not found

¿Por qué se pasa bash a xargs ?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Sugerimos evitar las complicaciones de xargs y combinar el máximo en un único script awk .

 kubectl get pods -A | awk '/Error/{system("kubectl get pod "$2" -n="$1" -oyaml")}'|grep phase

O obtenga resultados aún más detallados:

 kubectl get pods -A | awk '/Error/{system("kubectl get pod "$2" -n="$1" -oyaml")}'|grep -E "(^ name|^ phase)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!